package tech.aistar.mapper.order;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import tech.aistar.entity.ServiceOrder;

import java.util.List;

/**
 * Created by 23827 on 2019/9/28.
 */
public interface ServiceOrderMapper {
    //    查询所有的

    @Select("select * from service_order")
    List<ServiceOrder> findAll();

//    通过服务订单的订单编号进行查找

    List<ServiceOrder> find(@Param("order_number") String order_number);

//    删除

    @Update("update service_order set status = 0 where id = #{value}")
    void delById(Integer id);

//    添加

    void insertServiceOrder(ServiceOrder serviceOrder);

    //    更新
    void updateServiceOrder(ServiceOrder serviceOrder);

//    通过id进行查询
    @Select("select * from service_order where id = #{value}")
    List<ServiceOrder> getById(Integer id);

    //通过id查一个对象
    @Select("select * from service_order where id = #{id}")
    ServiceOrder findByIdOne(Integer id);

    //通过userinfo_id查找订单
    @Select("select * from service_order where userinfo_id = #{userinfo_id}")
    List<ServiceOrder> findByUserinfoId(Integer userinfo_id);

    @Select("select id from service_order where order_number = #{order_number} ")
    Integer findByOrderNumber(String order_number);


    //通过id查出订单编号
    @Select("select order_number from service_order where id = #{value}")
    String selectById(Integer id);

    //修改部分

    void updateOne(ServiceOrder serviceOrder);
}
